#! /usr/bin/python
from chimera.core.managerlocator import ManagerLocator
from chimera.core.exceptions import printException

db = None

def main():
    # Load manager
    manager = ManagerLocator.locate("localhost")
    manager.ping()

    # Load database object
    db = manager.getProxy("/Database/db")

    if db:
        dv = db.getViewer()
        line = raw_input(">>>")
        while line != "exit":
            try:
                exec line in globals(), locals()
            except Exception, ex:
                printException(ex)
            line = raw_input(">>>")
    else:
        print "Database not loaded"

if __name__ == '__main__':
	main()